/**  
 * @Title:  AttachmentsController.java   
 * @Package com.platform.controller   
 * @Description: (用一句话描述该文件做什么)   
 * @author: <a href="mailto:15909910367@163.com">吴先生</a> 
 * @date:   2021年4月15日 下午6:39:01   
 * @version V1.0 
 * @Copyright: 2021 吴先生.
 */
package com.platform.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.platform.base.PageUtil;
import com.platform.base.R;
import com.platform.dto.Attachments;
import com.platform.service.IAttachments;

import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**   
 * @ClassName:  AttachmentsController   
 * @Description:附件管理
 * @author: <a href="mailto:15909910367@163.com">吴先生</a>  
 * @date:   2021年4月15日 下午6:39:01   
 *     
 * @Copyright: 2021 吴元森.  
 */
@Api(tags = "OMS-附件管理模块")
@Controller
@RequestMapping("attach")
public class AttachmentsController {
	
	@Autowired
	IAttachments attachmentService;
	
	@RequestMapping(value="data",method=RequestMethod.GET)
	@ResponseBody
	@ApiOperation(value="分页查询")
	@ApiImplicitParams({
        @ApiImplicitParam(name = "ds", value = "数据对象", required = true, dataType = "Attachments"),
        @ApiImplicitParam(name = "start", value = "页码", required = true, dataType = "int"),
        @ApiImplicitParam(name = "limit", value = "每页显示条数", required = true, dataType = "int")
	})
	public R<?> selectAll(Attachments attach,Integer start,Integer limit,HttpServletRequest request,HttpServletResponse response,HttpSession session) {
		PageUtil pageUt = new PageUtil();
		pageUt.setPageIndex(start);
		pageUt.setPageSize(limit);
		pageUt.setParams(BeanUtil.beanToMap(attach));
		List<Attachments> atts = attachmentService.selectByMapPaging(pageUt);
		return R.success(atts, pageUt.getTotal());
	}
}
